package com.ccys.cms.service.consultation.impl;

import cn.hutool.core.util.IdUtil;
import com.ccys.cms.service.consultation.BookingPaymentPhotoService;
import com.ccys.db.entity.TblBookingPayment;
import com.ccys.db.entity.TblBookingPaymentPhoto;
import com.ccys.db.rely.service.impl.BaseServiceImpl;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：XLY
 * @Date：2024/1/12 0012
 */

@Service
public class BookingPaymentPhotoServiceImpl extends BaseServiceImpl<TblBookingPaymentPhoto> implements BookingPaymentPhotoService {
    @Override
    public void insertBatch(TblBookingPayment model) {

        List<TblBookingPaymentPhoto> photoList = model.getPhotoList();
        if (CollectionUtils.isNotEmpty(photoList)) {
            photoList.forEach(x -> {
                x.setId(IdUtil.getSnowflakeNextIdStr());
                x.setCybersourceId(model.getId());
            });
            this.insertAll(photoList);
        }
    }
}
